package TestMethod;


public class ArrayDemo {
    //定义一个用于修改某个数组元素值的方法
    public void updateArray(int[] a){
        a[3]=15;
        System.out.println("数组a的元素为:");
        for (int n:a) {
            System.out.print(n+"  ");
        }
        System.out.println();
    }
    public static void main(String[] args) {
        ArrayDemo arrayDemo=new ArrayDemo();
        int[] arr={1,2,3,4,5};
        System.out.println("方法调用前arr的元素为: ");
        for (int n:arr) {
            System.out.print(n+"  ");
        }
        System.out.println();
        arrayDemo.updateArray(arr);
        System.out.println("方法调用后arr的元素为: ");
        for (int n:arr) {
            System.out.print(n+"  ");
        }
    }
}
